package com.health.pay.tencent.business;

import org.slf4j.LoggerFactory;

import com.health.pay.tencent.common.Log;
import com.health.pay.tencent.common.XMLParser;
import com.health.pay.tencent.protocol.unifiedorder.UnifiedorderReqData;
import com.health.pay.tencent.protocol.unifiedorder.UnifiedorderResData;
import com.health.pay.tencent.service.UnifiedorderService;
import com.sun.istack.internal.NotNull;

public class UnifiedorderBusiness {

	private UnifiedorderService unifiedorderService;

	public UnifiedorderBusiness() throws IllegalAccessException,
			ClassNotFoundException, InstantiationException {
		unifiedorderService = new UnifiedorderService();
	}

	public UnifiedorderResData run(@NotNull UnifiedorderReqData unifiedorderReqData) throws Exception {
		String unifiedorderServiceResponseString;
		String objXmlString=XMLParser.map2XmlString(unifiedorderReqData.toMap());
		unifiedorderServiceResponseString = unifiedorderService
				.request(objXmlString);
		UnifiedorderResData unifiedorderResData=(UnifiedorderResData) XMLParser.getObjectFromXML(unifiedorderServiceResponseString,UnifiedorderResData.class);
		unifiedorderResData.setUnifiedorderServiceResponseString(unifiedorderServiceResponseString);
		return unifiedorderResData;
	}


}
